syntax enable
syntax on
colorscheme koehler


set hlsearch
set cindent shiftwidth=4
"设定文件浏览器目录为当前目录
set bsdir=buffer   
set autochdir                                                                   

set number

set cursorline
highlight CursorLine cterm=bold ctermbg=blue
"show tabs
set listchars=tab:`\ 
set list
hi SpecialKey ctermfg=DarkGray ctermbg=0


set backspace=2

set fenc=utf-8

" set keyboard mode to vim, not vi's
set nocompatible

filetype on
filetype plugin on
filetype indent on

" set cursor's line and column number in status bar
set ruler
set rulerformat=%20(%2*%<%f%=\ %m%r\ %3l\ %c\ %p%%%)

" allow backspace and cursor over end of line
set whichwrap+=<,>,h,l
" 带有如下符号的单词不要被换行分割
set iskeyword+=_,@,%,#
" 增强模式中的命令行自动完成操作
set wildmenu
"使用murphy调色板
"colo murphy
"修正自动C式样注释功能
set comments=s1:/*,mb:*,ex0:/


" tell me which line has modified by using ': commands' command
set report=0

" split windows with blank space for easier reading
set fillchars=vert:\ ,stl:\ ,stlnc:\

""""""""""""""""""""""""""""""""""""""""""""""
" searching and matching
""""""""""""""""""""""""""""""""""""""""""""""
" hilight matching parentheses
set showmatch
" no case sensitive
set noignorecase
set incsearch
" padding 3 lines when cursor at bottom and top position
set scrolloff=3
" show me the file type and encoding in status bar
set statusline=%F%m%r%h%w\ [FORMAT=%{&ff}]\ [TYPE=%Y]\ [POS=%l,%v][%p%%]\ %{strftime(\"%d/%m/%y\ -\ %H:%M\")}
" always show me the status bar
set laststatus=2
" inherit the indent line before
set autoindent
set smartindent
set cindent

set shiftwidth=4
set tabstop=4
set softtabstop=4
set expandtab

set nowrap
set smarttab

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" CTags && cscope
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" winManager
let g:winManagerWindowLayout='FileExplorer|TagList'
nmap wm :WMToggle<cr>

let Tlist_Sort_Type = "name"

let Tlist_Use_Right_Window = 1

let Tlist_Compart_Format = 1

let Tlist_Exist_OnlyWindow = 1

let Tlist_File_Fold_Auto_Close = 0

let Tlist_Enable_Fold_Column = 1

"使用quickfix窗口来显示cscope结果
set cscopequickfix=s-,c-,d-,i-,t-,e-       

"""""""""""""""""""""""""""""""""""""""""""""""""""""""
set nofoldenable

"miniBufExpl循环buffer并在当前窗口打开
let g:miniBufExplMapCTabSwitchBufs = 1

"miniBufExpl循环切换窗口用<C-h,j,k,l>向“左，下，上，右”切换窗口
let g:miniBufExplMapWindowNavVim = 1

"miniBufExpl循环切换窗口用<C-箭头>向“左，下，上，右”切换窗口
let g:miniBufExplMapWindowNavArrows = 1

"<F12>在新的buffer中打开c/h文件
nnoremap <silent> <F12> :A<CR>

"<F3>查找光标所在的当前单词
nnoremap <silent> <F3> :Grep<CR>

"自动补全
filetype plugin indent on
set completeopt=longest,menu
let g:SuperTabRetainCompletionType=2
let g:SuperTabDefaultCompletionType="<C-X><C-O>"                 


" 可以在buffer的任何地方使用鼠标（类似office中在工作区双击鼠标定位）
set mouse=a
set selection=exclusive
set selectmode=mouse,key

map <F4> :call ToggleMouse()<CR>
function! ToggleMouse() 
    if (&g:mouse == "a")
        echo "Select/Copy ON"
        set nonumber
        set mouse=v
    else
        echo "Select/Copy OFF"
        set number
        set mouse=a
    endif
endfunction

" C的编译和运行
map <F5> :call CompileRunGcc()<CR>
func! CompileRunGcc()
    exec "w"
    exec "!gcc % -Wall -g -o /tmp/%< && /tmp/%<"
endfunc

" C++的编译和运行
map <F6> :call CompileRunGpp()<CR>
func! CompileRunGpp()
    exec "w"
    exec "!g++ % -Wall -g -o /tmp/%< && /tmp/%<"
endfunc

" ShellScript运行
map <F7> :call RunShellScript()<CR>
func! RunShellScript()
    exec "w"
    exec "!chmod 711 %"
    exec "!./%"
endfunc

" PYTHON 运行
map <F8> :call RunPythonScript()<CR>
func! RunPythonScript()
    exec "w"
    exec "! python %"
endfunc

" OPENCV
map <F9> :call CompileRunOpenCV()<CR>
func! CompileRunOpenCV()
    exec "w"
    exec "!g++ % -Wall -g $(pkg-config --cflags --libs opencv) -lpng -o /tmp/%< && /tmp/%<"
endfunc

" add ctags & cscope indexes
"set tags=/home/finalx/projects/kk-mr1-shinano2/tags
"cs add /home/finalx/projects/kk-mr1-shinano2/cscope.out

" add ctags & cscope indexes
" set tags=/home/finalx/projects/kk-shinano/tags
" cs add /home/finalx/projects/kk-shinano/cscope.out

" add ctags & cscope indexes
"set tags=/home/finalx/projects/aosp/tags
"cs add /home/finalx/projects/aosp/cscope.out

" add ctags & cscope indexes
"set tags=/home/finalx/projects/semc_apps/vendor/semc/packages/apps/experience-flow2-live-wallpaper/tags
"cs add /home/finalx/projects/semc_apps/vendor/semc/packages/apps/experience-flow2-live-wallpaper/cscope.out

" add ctags & cscope indexes
"set tags=/home/finalx/projects/semc_apps/vendor/semc/packages/apps/screen-recorder/tags
"cs add /home/finalx/projects/semc_apps/vendor/semc/packages/apps/screen-recorder/cscope.out

" add ctags & cscope indexes
set tags=/home/finalx/Documents/dEQP-2014.2.3-2014-09-05-Sony/src/tags
cs add /home/finalx/Documents/dEQP-2014.2.3-2014-09-05-Sony/src/cscope.out

" add ctags & cscope indexes
set tags=/home/finalx/projects/gat/test/tests/opengl/khronos/conform_3.0/tags
cs add /home/finalx/projects/gat/test/tests/opengl/khronos/conform_3.0/cscope.out
